<template>
    <div>
        <div>
            名字：{{ patient.name }}
        </div>

        <div>
            省：{{ patient.provinceCode }}
        </div>

        <div>
            市：{{ patient.cityCode }}
        </div>
        <hr>
        <AddressInfo :patient="patient"></AddressInfo>
    </div>
</template>
<script setup lang="ts">
import { reactive, onMounted } from 'vue';
import type { PatientInfo } from './patient-info';
import { getPatientInfo } from './patient-service';
import AddressInfo from './address-info.vue';

const patient = reactive<PatientInfo>({})
onMounted(async () => {
    const newPatient = await getPatientInfo().then(v => {
        console.log('then: 查询到数据', v)
        return v
    })
    console.log('after await: ', newPatient)
    patient.name = newPatient.name
    patient.cityCode = newPatient.cityCode
    patient.provinceCode = newPatient.provinceCode
})
</script>